package ldzy.soft2;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.io.PrintWriter;

public class Servlet1 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("hello1");
//        第一步：通过this的方法来获取ServletConfig对象
        ServletConfig config=this.getServletConfig();
//        第二步：ServletConfig对象的方法来读取对应键的值
        String schoolName=config.getInitParameter("schoolName");
//        第一步：通过response参数获取PrintWriter对象，把输出内容写入到这个对象中就会自动输出到浏览器
        PrintWriter out=response.getWriter();
//        第二步：把输出内容用write方法写入out
        out.write(schoolName);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
